// 每行首尾为 1，其余数字为上方和左上方的和

var generate = function (numRows) {
  let triangle = [];
  for (let i = 0; i < numRows; i++) {
    triangle[i] = [];
    triangle[i][0] = 1;
    for (let j = 1; j < i; j++) {
      triangle[i][j] = triangle[i - 1][j - 1] + triangle[i - 1][j];
    }
    triangle[i][i] = 1;
  }
  return triangle;
}